﻿@page "/Axes/LabelsFormat"
@using LiveChartsCore.SkiaSharpView.Blazor
@using LiveChartsCore;
@using LiveChartsCore.SkiaSharpView;
@using LiveChartsCore.SkiaSharpView.Painting;
@using SkiaSharp;

<CartesianChart Series="@series"
                XAxes="@xAxes"
                YAxes="@yAxes">
</CartesianChart>

@code {
    private static double[] values1 = new double[] { 426, 583, 104 };
    private static double[] values2 = new double[] { 200, 558, 458 };
    private static string[] labels = new string[] { "Sergio", "Lando", "Lewis" };
    private static string Labeler(double value) => value.ToString("C2");

    private ISeries[] series = new ISeries[]
    {
        new ColumnSeries<double> { Values = values1 },
        new ColumnSeries<double> { Values = values2, Fill = null }
    };

    private Axis[] xAxes = new Axis[]
    {
        new Axis
        {
            Name = "Salesman/woman",
            Labels = labels
        }
    };

    private Axis[] yAxes = new Axis[]
    {
        new Axis
        {
            Name = "Sales",
            NamePadding = new LiveChartsCore.Drawing.Padding(0, 15),
            Labeler = Labeler,
            LabelsPaint = new SolidColorPaint(SKColors.Blue)
        }
    };
}
